<template>
	<view class="page">
		<!-- 信息栏 start -->
		<view class="user-box">
			<view class="head-out">
				<view class="user-head">
					<view class="left-out">
						<image :src="userInfo.icon" class="head-img" mode=""></image>
					</view>
					<view class="head-center">
						<view class="head-name">
							{{userInfo.nickname}}
						</view>
						<button type="primary" class="hea-mem">黄金会员</button>
					</view>
					<view class="head-icon iconfont icon-arr-right" @tap="toUserInfo" style="font-size: 40px;"></view>
				</view>
			</view>
		</view>
		<!-- 信息栏 end -->
		
		<!-- 积分栏 start -->
		<view class="resu-out">
			<view class="resu-box">
				<view class="box-resu" v-for="(resu, ind) in results" :key="ind">
					<view class="resu-title">{{resu.title}}</view>
					<view class="resu-score">{{resu.score}}</view>
				</view>
			</view>
		</view>
		<!-- 积分栏 end -->
		
		<!-- 订单 start -->
		<view class="order-out">
			<view class="order-box">
				<view class="box-order" v-for="(order, ind) in orders" :key="ind">
					<view :class="order.icon" style="font-size: 40px;color: gray;text-align: center;"></view>
					<view class="order-text">{{order.title}}</view>
				</view>
			</view>
		</view>
		<view class="order-out" style="margin-top: -1px;">
			<view class="order-box">
				<view class="">
					<view class="iconfont icon-daohanglanhongxin" style="color: red;font-size: 40px; height: 40px;"></view>
					<view class="store-text">我的收藏</view>
				</view>
				<view class="box-store" v-for="(store, ind) in stores" :key="ind">
					<view class="store-score">{{store.score}}</view>
					<view class="store-title">{{store.title}}</view>
				</view>
			</view>
		</view>
		<!-- 订单 end -->
		
		<view class="order-out">
			<view class="item-box">
				<view class="box-item" v-for="(item, ind) in items" :key="ind">
					<view class="item-in">
						<view class="item-left">
							<view :class="item.icon" style="font-size: 30px; color: gray;"></view>
							<view class="item-title">{{item.title}}</view>
						</view>
						<view class="item-right">
							<view class="">{{item.num}}</view>
							<view @tap="toOperate" :data-param="item.method" class="right-icon iconfont icon-arr-right"></view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				results: [{title: '积分',score: '100'},{title: '优惠券',score: '100'},{title: '关注',score: '100'}],
				orders: [{icon: 'iconfont icon-dingdan', title: '我的订单'},{icon: 'iconfont icon-daifukuan',title: '待付款'},
					{icon: 'iconfont icon-daishouhuo',title: '待收货'},{icon: 'iconfont icon-pingjia',title: '待评价'},
					{icon: 'iconfont icon-shouhou',title: '售后服务'}],
				stores: [{title: '商品', score: '100'}, {title: '专题', score: '100'}, {title: '话题', score: '100'}],
				items: [{icon: 'iconfont icon-zuji', title: '我的足迹',num: '10'}, {icon: 'iconfont icon-pingjia', title: '我的评价',num: '10'},
					{icon: 'iconfont icon-dizhi', title: '地址管理',num: '10'},{icon: 'iconfont icon-huiyuan-', title: '我的会员',num: '黄金会员'},
					{icon: 'iconfont icon-fuwuzhongxin', title: '服务中心',num: ''},{icon: 'iconfont icon-shezhi', title: '系统设置',num: '',method: 'toSettiong'}],
				userInfo: {}
			}
		},
		onShow() {
			var userInfo = this.getGlobalUser("globalUser");
			if(userInfo == null || userInfo == undefined || userInfo == ""){
				uni.navigateTo({
					url:'../login/login'
				})
			} else {
				this.userInfo = userInfo;
			}
			
		},
		methods: {
			toUserInfo(){
				uni.navigateTo({
					url: 'userinfo/userinfo'
				})
			},
			toOperate(e){
				var param = e.currentTarget.dataset.param;
				if(param == 'toSettiong') {
					uni.navigateTo({
						url: 'setting/setting'
					})
				}
			}
		}
	}
</script>

<style>
	@import url("user.css");
	@import url("../../static/iconfont/iconfont.css");
</style>
